using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SBPweb.Themes.Windows;

namespace SBPweb.Controls.Windows.Tab
{
	/// <summary>
	/// Class of TabControlContainer
	/// </summary>
	[ToolboxBitmap(typeof(System.Windows.Forms.TabControl))]
	public partial class TabControlContainer : SBPweb.Controls.Windows.Common.UserControl
	{
		/// <summary>
		/// Constructor of TabControlContainer
		/// </summary>
		public TabControlContainer()
		{
			InitializeComponent();
			this.tabHeader1.Parent = this.tabControl1;
			RegisterEvents();
		}

		private void RegisterEvents()
		{
			DefaultLookAndFeel.OnSkinChanged += new EventHandler(DefaultLookAndFeel_OnSkinChanged);
		}

		private void DefaultLookAndFeel_OnSkinChanged(object sender, EventArgs e)
		{
			tabHeader1.Visible = Skin != null;
		}

		/// <summary>
		/// Tab control
		/// </summary>
		[Category("Behavior")]
		[Browsable(true)]
		public TabControl TabControl
		{
			get
			{
				return tabControl1;
			}
			set
			{
				tabControl1 = value;
			}
		}

		/// <summary>
		/// Selected index of tabcontrol
		/// </summary>
		public int SelectedIndex
		{
			get
			{
				return tabControl1.SelectedIndex;
			}
			set
			{
				tabControl1.SelectedIndex = value;
			}
		}

		/// <summary>
		/// Selected tab of tabcontrol
		/// </summary>
		public System.Windows.Forms.TabPage SelectedTab
		{
			get
			{
				return tabControl1.SelectedTab;
			}
			set
			{
				tabControl1.SelectedTab = value;
			}
		}

		/// <summary>
		/// Tabpages of tabcontrol
		/// </summary>
		public TabControl.TabPageCollection TabPages
		{
			get
			{
				return tabControl1.TabPages;
			}
		}

		/// <summary>
		/// Count of tabs
		/// </summary>
		public int TabCount
		{
			get
			{
				return tabControl1.TabCount;
			}
		}

		/// <summary>
		/// TabControl.Selected event
		/// </summary>
		public event TabControlEventHandler Selected
		{
			add
			{
				tabControl1.Selected += value;
			}
			remove
			{
				tabControl1.Selected -= value;
			}
		}

		/// <summary>
		/// TabControl.Selecting event
		/// </summary>
		public event TabControlCancelEventHandler Selecting
		{
			add
			{
				tabControl1.Selecting += value;
			}
			remove
			{
				tabControl1.Selecting -= value;
			}
		}

		/// <summary>
		/// TabControl.SelectedIndexChanged event
		/// </summary>
		public event EventHandler SelectedIndexChanged
		{
			add
			{
				tabControl1.SelectedIndexChanged += value;
			}
			remove
			{
				tabControl1.SelectedIndexChanged -= value;
			}
		}
	}
}
